package com.inno.subject.domain.config;

import com.inno.subject.domain.feign.FeignProperties;
import com.inno.subject.domain.feign.FeignRequestInterceptor;
import feign.Logger;
import feign.Retryer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author shenzeyang
 */
@Configuration
public class FeignConfig {

    private final FeignProperties feignProperties;
    public FeignConfig (FeignProperties feignProperties){
        this.feignProperties = feignProperties;
    }
    @Bean
    public Retryer retryer(){
        return new Retryer.Default(1000,1000,3);
    }

    @Bean
    public FeignRequestInterceptor feignRequestInterceptor(){
        return new FeignRequestInterceptor(feignProperties);
    }
}
